%% bdary_edge (for Neumann and Robin)
function bde = bdary_edge(mesh, index)
if isfield(mesh, "bdary")
    bde = mesh.bde(mesh.bde(:,5) == index,1:4);
else
    gap_x = mesh.Nx;
    gap_y = mesh.Ny;
    switch index
        case 1 % bottom
            bde = mesh.bde(1:gap_x,:);
        case 2 % right
            bde = mesh.bde(gap_x+1:gap_x+gap_y,:);
        case 3 % top
            bde = mesh.bde(gap_x+gap_y+1:2*gap_x+gap_y,:);
        case 4 % left
            bde = mesh.bde(2*gap_x+gap_y+1:end,:);
        otherwise
            error("Invalid Nbd.");
    end
end
end